package com.tian.common.enums;

import lombok.Getter;

/**
 * {@code @description:} 权限菜单操作类型枚举类
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-09-15 15:42
 * {@code @version:} 1.0
 */
@Getter
public enum OptTypeEnum {
    ADD(1, "添加", "add"),
    UPDATE(2, "修改", "update"),
    DELETE(3, "删除", "delete"),
    QUERY(4, "查询", "query"),
    AUTHORIZATION(5, "授权", "authorization"),
    EXPORT(6, "导出", "export");

    private final Integer code;
    private final String message;
    private final String en;

    OptTypeEnum(Integer code, String message, String en) {
        this.code = code;
        this.message = message;
        this.en = en;
    }

    public static String getMessage(Integer code) {
        for (OptTypeEnum optTypeEnum : OptTypeEnum.values()){
            if (optTypeEnum.getCode().equals(code)){
                return optTypeEnum.getMessage();
            }
        }
        return null;
    }

    public static String getEn(Integer code) {
        for (OptTypeEnum optTypeEnum : OptTypeEnum.values()){
            if (optTypeEnum.getCode().equals(code)){
                return optTypeEnum.getEn();
            }
        }
        return null;
    }
}
